
import React from "react";
import {Form} from "antd";
import {diffProps} from "../../libs/funcs";

/**
 * 输入框
 */
class FormText extends React.Component{

    constructor(props) {
        super(props);
        this.state={}
    }

    render() {
        const {getFieldDecorator} =  this.props.form;
        const {initialValue,label,field,rules,allowClear,placeholder,disabled,addonAfter,addonBefore,options} = this.props;
        const new_props = diffProps(this.props,["form","initialValue","label","field","rules","allowClear","placeholder"]);
        let val;
        if (options && options.hasOwnProperty(String(initialValue))) {
            val = options[String(initialValue)];
        } else {
            val = initialValue;
        }

        return (
            <Form.Item label={label ? label : "输入框"} {...new_props}>
                <label>{val}</label>
            </Form.Item>
        );
    }
}

export default FormText;
